package loganalyzervma;
import java.util.Vector;

/**
 *
 * @author ashenhav
 */
public class Interfacedetail {
    
    private String interfaceName;
    private String ip;
    private String netmask;
    private String mtu;
    private String HWadress;
    private Vector interfaceParamContainer;
    
    public Interfacedetail(){
        interfaceName = "";
        ip = "";
        netmask = "";
        mtu = "";
        HWadress = ""; 
        interfaceParamContainer = null;
    }
            
    public void setinterfaceName(String st) {
        if (st.contains("save_netdev_info() ")) {
        interfaceName = st.substring(st.lastIndexOf("save_netdev_info() name :") + 25);
        interfaceName = st.substring(st.indexOf("save_netdev_info() name :") + 25);
        }
        else {
        interfaceName = st.substring(st.lastIndexOf("dev: ") + 1);
        interfaceName = st.substring(st.indexOf("dev:  ") + 1);
        }
        }
        
        
    
    public void setip(String st) {
        if (st.contains("save_netdev_info() ")) {
        ip = st.substring(st.indexOf("save_netdev_info() ip: ") + 23);
        }
        else {
        ip = st.substring(st.indexOf("save_netdev_info() ip: ") + 23);
        }
        }
        
    
    public void setnetmask(String st) {
        netmask = st.substring(st.indexOf("save_netdev_info() netmask: ") + 27);
    }
    
    public void setmtu(String st) {
        mtu = st.substring(st.indexOf("save_netdev_info() mtu: ") + 24);
    }
    
    public void setHWadress(String st) {
        if (st.contains("HW adress:")){
            HWadress = st.substring(st.indexOf("HW adress: ") + 10);   
        }
    }
    
    
    public Vector getinterfaceParamContainer() {
        interfaceParamContainer = new Vector();
        interfaceParamContainer.add(interfaceName);
        interfaceParamContainer.add(ip);
        interfaceParamContainer.add(netmask);
        interfaceParamContainer.add(mtu);
        interfaceParamContainer.add(HWadress);
     
        
        return interfaceParamContainer;
    }
}
